#ifndef POSITION_H
#define POSITION_H

#include <stack>
#include <string>
#include "Piece.h"
#include "Board.h"
#include "GameState.h"
using namespace std;

class Position
{
// properties
private:
	Board board;
	stack<GameState> gameStateStack;

// constructors
public:
	Position();
	Position(Position& position);
	Position(string strPos);
	
// functions
public:
	void SetFromFEN(string fenString);
	bool IsWhiteToMove();
	bool IsBlackToMove();
	bool GetTurn();
	bool IsPiecePlayable(int square);
	bool IsPieceWhite(Piece piece);
	bool IsPieceBlack(Piece piece);
	bool IsEmptyOrOpponent(int square);
	bool IsEmptyOrColor(int square, bool color);
	Piece GetPiece(int square);
	void Play(Move m);
	void Unplay(Move m);
	void Move(int from, int to);
	void SetPiece(Piece piece, int square);
	void SetStartPosition();
	public string GetSimplifiedHashCode();


private:
	const char[] fenPieceCodes = { 'P', 'N', 'B', 'R', 'Q', 'K', 'p', 'n', 'b', 'r', 'q', 'k' };
	String GetPseudoFEN();
	bool IsSquareEmpty(int sq);
	bool WhiteCanCastleKingSide();
	bool BlackCanCastleKingSide();
	bool WhiteCanCastleQueenSide();
	bool BlackCanCastleQueenSide();
	int LastEnPassant();
	bool IsEqual(Position pos);
	bool IsEqual(stack<GameState> s1, stack<GameState> s2);
	int Evaluate(ref int[] coeff);
	int GetPlayedMoveNumber();
	int GetMovesWithoutCaptureOrPawnPush();
	object GetGameStateStack();
	bool IsThreeTimesRepetitionDraw();
};

#endif


